package com.example.practical_training_projects.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.example.practical_training_projects.entity.user;
import com.example.practical_training_projects.entity.pc;
import com.example.practical_training_projects.service.userService;
import com.example.practical_training_projects.service.pcService;

@RestController
@RequestMapping("login")
@CrossOrigin
public class loginController {
    @Autowired
    private userService userService;

    @Autowired
    private pcService pcService;

    @PostMapping("authenticate")
    public user authenticateUser(@RequestBody user inputUser) {
        return userService.authenticateUser(inputUser.getUser_name(), inputUser.getUser_password());
    }

    @PostMapping("pcAuthenticate")
    public pc authenticatePc(@RequestBody pc inputPc) {
        return pcService.authenticatePc(inputPc.getPc_name(), inputPc.getPc_password());
    }
}
